package com.yk.faceapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.allinpay.xed.R;
import com.yk.faceapplication.entity.StudyInfo;

import java.util.List;


public class LoanTermAdapter extends BaseAdapter {
	private Context context = null;
	private List<StudyInfo> list = null;

	public LoanTermAdapter(Context context, List<StudyInfo> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		if (list != null) return list.size();
		return 0;
	}

	@Override
	public Object getItem(int position) {
		if (list != null) list.get(position);
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.item_loan_term, null);
			viewHolder.optionTV = (TextView) convertView.findViewById(R.id.option_tv);
			convertView.setTag(viewHolder);
		}
		else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.optionTV.setText(list.get(position).getValue());

		return convertView;
	}

	class ViewHolder {
		private TextView optionTV = null;
	}

}
